import {nanoid, PageContainer} from "@ant-design/pro-components";
import {Card, Col, Row, Space, Collapse, Typography, List, Tag, Skeleton, Table, Button} from "antd";
import {getUserInfo} from "@/utils/format";
import SchoolDashboard from "@/pages/Province/Schools/SchoolDashboard";
import './font.css'
import './xxx.css'
import React, {useEffect, useState} from "react";
import ProgressView from '@/pages/Syl/DisciCons/progress'
import {history} from "umi";
import {Link} from "@umijs/preset-dumi/lib/theme";

// // 大人才
// import Emm01_1 from "./components/wx_components/Emm01_1";
// import Emm01_2 from "./components/wx_components/Emm01_2";
// import Emm01_3 from "./components/wx_components/Emm01_3";
//
// // 大项目
// import Emm02_1 from "./components/wx_components/Emm02_1";
// import Emm02_2 from "./components/wx_components/Emm02_2";
// import Emm02_3 from "./components/wx_components/Emm02_3";
// // 大奖项
// import Emm03_1 from "./components/wx_components/Emm03_1";
// import Emm03_2 from "./components/wx_components/Emm03_2";
//
// // 大平台
// import Emm04_1 from "./components/wx_components/Emm04_1";
// import Emm04_2 from "./components/wx_components/Emm04_2";

// 大人才
import Emm01_1 from "./components/wx_components_2/Emm01_1";
import Table_01 from "./components/wx_components_2/Table_01";

// 大项目
import Emm01_2 from "./components/wx_components_2/Emm01_2";
import Table_02 from "./components/wx_components_2/Table_02";

// 大奖项
import Emm01_3 from "./components/wx_components_2/Emm01_3";
import Table_03 from "./components/wx_components_2/Table_03";
import Emm01_4 from "./components/wx_components_2/Emm01_4";
import Table_04 from "./components/wx_components_2/Table_04";


// 大平台
import Emm01_5 from "./components/wx_components_2/Emm01_5";
import Table_05 from "./components/wx_components_2/Table_05";

import {AllSubjects} from "@/services/DashApi";
import SchoolLogo from "../../../config/logos/SchoolLogo";
import SchoolSimplify from "../../../config/logos/SchoolSimplify";
import Pie from "@/pages/Province/SubjectDetail/components/Pie";
import {ColumnsType} from "antd/es/table";
import {Tjd4Evaluation, TjdLogo} from "@/services/Province/Dashboard";

const columns: ColumnsType = [
  {
    title: '学校',
    dataIndex: 'name',
    key: 'name',
    render: (text, data, idx) => {
      console.log("@@@", text, data, idx)
      return <>
        <img src={SchoolLogo[text]} style={{width: 20, marginBottom: 4, marginRight: 5}}/>
        {text}
      </>
    },
  },
  {
    title: '学科或学科群',
    dataIndex: 'subject',
    key: 'subject',
  },
  {
    title: '中央预算经费',
    dataIndex: 'ctr_budg_fund',
    key: 'ctr_budg_fund',
  },
  {
    title: '中央实际到账经费',
    key: 'ctr_receive_fund',
    dataIndex: 'ctr_receive_fund',
  },
  {
    title: '中央实际支出经费',
    key: 'ctr_expend_fund',
    dataIndex: 'ctr_expend_fund',
  },
];


export default () => {
  // 根据不同的角色展示不的页面
  const userInfo = getUserInfo()

  if (!userInfo || !userInfo.token) {
    history.replace('/user/login')
    return <></>
  }

  if (userInfo.roleid === 4) {
    return <ProgressView/>
  }

  if (userInfo.role === '学校管理员') {
    history.replace('/check_all_discipline')
    return <></>
    // return <SchoolDashboard name={userInfo.univ_name}/>
  }

  // 突击队学科 - 数据
  const [schoolData, setSchoolData] = useState([])
  const [reload, setReload] = useState(false)
  const [loading, setLoading] = useState(true) // 加载 42 个学科的 loading

  // 评估数据
  const [evaluationData, setEvaluationData] = useState([])

  // 请求数据
  useEffect(() => {
    setLoading(true)
    TjdLogo().then(res => {
      console.log("@突击队logo", res)
      if (res.status === 0) {
        setSchoolData(res.data)
        setLoading(false)
      } else {
        setLoading(false)
      }
    })
    Tjd4Evaluation().then(res => {
      console.log("@@@突击队学科第四轮评估情况", res)
      if (res.status === 0) {
        setEvaluationData(res.data)
      }
    })
  }, [reload])

  // // 建设经费数据
  // const findData = [
  //   {key: nanoid(), name: "南昌大学", subject: "绿色食品学科群", "ctr_budg_fund": 888, "ctr_receive_fund": 888, "ctr_expend_fund": 888},
  //   {key: nanoid(), name: "南昌大学", subject: "临床医学与公共卫生大健康学科群", "ctr_budg_fund": 888, "ctr_receive_fund": 888, "ctr_expend_fund": 888},
  //   {key: nanoid(), name: "江西师范大学", subject: "马克思主义理论", "ctr_budg_fund": 888, "ctr_receive_fund": 888, "ctr_expend_fund": 888},
  //   {key: nanoid(), name: "江西农业大学", subject: "畜牧学", "ctr_budg_fund": 888, "ctr_receive_fund": 888, "ctr_expend_fund": 888},
  //   {key: nanoid(), name: "江西财经大学", subject: "统计学", "ctr_budg_fund": 888, "ctr_receive_fund": 888, "ctr_expend_fund": 888},
  //   {key: nanoid(), name: "华东交通大学", subject: "交通运输工程", "ctr_budg_fund": 888, "ctr_receive_fund": 888, "ctr_expend_fund": 888},
  //   {key: nanoid(), name: "江西中医药大学", subject: "中药学", "ctr_budg_fund": 888, "ctr_receive_fund": 888, "ctr_expend_fund": 888},
  //   {key: nanoid(), name: "景德镇陶瓷大学", subject: "陶瓷设计与美术", "ctr_budg_fund": 888, "ctr_receive_fund": 888, "ctr_expend_fund": 888},
  //   {key: nanoid(), name: "江西理工大学", subject: "冶金工程", "ctr_budg_fund": 888, "ctr_receive_fund": 888, "ctr_expend_fund": 888},
  //   {key: nanoid(), name: "东华理工大学", subject: "地质资源与地质工程", "ctr_budg_fund": 888, "ctr_receive_fund": 888, "ctr_expend_fund": 888},
  //   {key: nanoid(), name: "南昌航空大学", subject: "环境科学与工程", "ctr_budg_fund": 888, "ctr_receive_fund": 888, "ctr_expend_fund": 888},
  // ];

  // @ts-ignore
  return (
    <PageContainer header={{
      title: '双一流建设“突击队”整体情况',
      breadcrumb: {},
    }}
    >
      <Space direction="vertical" size="middle" style={{display: 'flex'}}>

        {/*开始：Logo 学校-学科 链接*/}
        <Card title='突击队学科'>
          <Skeleton loading={loading} active/>

          <List
            grid={{
              gutter: 16,
              xs: 1,
              sm: 2,
              md: 4,
              lg: 4,
              xl: 4,
              xxl: 6,
            }}
            dataSource={schoolData.slice(0, 11)}
            renderItem={item => (
              <List.Item>
                <Link to={"/province/overview/"+SchoolSimplify[item.name]}>
                  <Card bordered={false} className="good-flex-center-horizon">
                    <p className="good-flex-center-horizon"><img src={SchoolLogo[item.name]}/></p>
                    <p style={{marginBottom: 0}} className="good-flex-center-horizon good-content-size"><Typography.Text strong>{item.name}</Typography.Text></p>
                    <p className="good-flex-center-horizon good-content-size"><Typography.Text strong>{item.subject}</Typography.Text></p>
                  </Card>
                </Link>
              </List.Item>
            )}
          />


          <Collapse defaultActiveKey={[]}>
            {/*<Panel header={<div>*/}
            {/*  <div>*/}
            {/*    <img src="/images/01.png"*/}
            {/*         style={{width: 20, height: 20, marginBottom: 5, marginRight: 5}}/>*/}
            {/*    <Typography.Text strong style={{fontSize: 16}}>南昌大学</Typography.Text>*/}
            {/*  </div>*/}
            {/*</div>} key="1">*/}
            {/*  <List*/}
            {/*    size="large"*/}
            {/*    bordered*/}
            {/*    dataSource={data}*/}
            {/*    renderItem={item => <List.Item>*/}
            {/*      <Link to="/">{item}</Link>*/}
            {/*    </List.Item>}*/}
            {/*  />*/}
            {/*</Panel>*/}
            {/*<Panel header={<div>*/}
            {/*  <div>*/}
            {/*    <img src="/images/02.jpg"*/}
            {/*         style={{width: 20, height: 20, marginBottom: 5, marginRight: 5}}/>*/}
            {/*    <Typography.Text strong style={{fontSize: 16}}>江西农业大学</Typography.Text>*/}
            {/*  </div>*/}
            {/*</div>} key="2">*/}
            {/*  <List*/}
            {/*    size="large"*/}
            {/*    bordered*/}
            {/*    dataSource={data}*/}
            {/*    renderItem={item => <List.Item>*/}
            {/*      <Link to="/">{item}</Link>*/}
            {/*    </List.Item>}*/}
            {/*  />*/}
            {/*</Panel>*/}

            {/* 渲染学校和学科*/}
            {/*{schoolData.map((item, idx) => {*/}
            {/*  return <Panel header={<div>*/}
            {/*    <div>*/}
            {/*      <img src={SchoolLogo[item.name]}*/}
            {/*           style={{width: 18, height: 18, marginBottom: 5, marginRight: 5}}/>*/}
            {/*      <Typography.Text strong style={{fontSize: 15}}>*/}
            {/*        <Space align="center">*/}
            {/*          <Typography.Text>{item.name}</Typography.Text>*/}

            {/*          /!* 学校标签 - Tag *!/*/}
            {/*          {item.name === "南昌大学" && (*/}
            {/*            <>*/}
            {/*              <Tag color="blue" style={{ marginBottom: 5}}>综合类</Tag>*/}
            {/*              <Tag color="blue" style={{ marginBottom: 5}}>公办</Tag>*/}
            {/*              <Tag color="blue" style={{ marginBottom: 5}}>双一流</Tag>*/}
            {/*              <Tag color="blue" style={{ marginBottom: 5}}>211</Tag>*/}
            {/*            </>*/}
            {/*          )}*/}
            {/*          {item.name !== "南昌大学" && (*/}
            {/*            <>*/}
            {/*              <Tag color="blue" style={{ marginBottom: 5}}>综合类</Tag>*/}
            {/*              <Tag color="blue" style={{ marginBottom: 5}}>公办</Tag>*/}
            {/*            </>*/}
            {/*          )}*/}
            {/*        </Space>*/}
            {/*      </Typography.Text>*/}
            {/*    </div>*/}
            {/*  </div>} key={idx}>*/}
            {/*    <List*/}
            {/*      size="large"*/}
            {/*      bordered*/}
            {/*      dataSource={item.subjects}*/}
            {/*      grid={{*/}
            {/*        gutter: 2,*/}
            {/*        xs: 2,*/}
            {/*        sm: 2,*/}
            {/*        md: 2,*/}
            {/*        lg: 4,*/}
            {/*        xl: 4,*/}
            {/*        xxl: 4,*/}
            {/*      }}*/}
            {/*      renderItem={(iitem, idx) => (*/}
            {/*        <List.Item style={{marginBottom: 0}}>*/}
            {/*          <Card title={iitem}>*/}
            {/*            <p className="good-content-size">*/}
            {/*              <Typography.Text>*/}
            {/*                填报情况：*/}
            {/*                {idx === 0 && <Tag>未填报</Tag>}*/}
            {/*                {idx === 1 && <Tag color="blue">填报中 75%</Tag>}*/}
            {/*                {idx > 1 && <>*/}
            {/*                  <Tag color="green">已填报</Tag>*/}
            {/*                  <a className="good-bold" target="_blank" href={"/province/subject_detail/01/"+iitem+"/"+item.name}>*/}
            {/*                    查看详情>>*/}
            {/*                  </a>*/}
            {/*                </>}*/}
            {/*              </Typography.Text>*/}
            {/*            </p>*/}
            {/*          </Card>*/}
            {/*        </List.Item>*/}
            {/*      )}*/}

            {/*    />*/}
            {/*  </Panel>*/}
            {/*})}*/}

            {/*<Panel header="This is panel header 2" key="2">*/}
            {/*  <p>{text}</p>*/}
            {/*</Panel>*/}
            {/*<Panel header="This is panel header 3" key="3">*/}
            {/*  <p>{text}</p>*/}
            {/*</Panel>*/}
          </Collapse>
        </Card>
        {/*结束：Logo 学校-学科 链接*/}

        {/*开始：学科评估情况*/}
        <Card title="突击队学科第四轮评估情况">
          <List
            grid={{gutter: 16, column: 4}}
            dataSource={evaluationData}
            renderItem={item => (
              <List.Item>
                <Card title={<div><img src={SchoolLogo[item.name]} style={{width: 20, height: 20, marginRight: 5, marginBottom: 4}}  />{item.name}</div>}>
                  <span style={{fontSize: 16}}>{item.subject}：<Typography.Text strong>{item.value}</Typography.Text></span>
                </Card>
              </List.Item>
            )}
          />
        </Card>
        {/*结束：学科评估情况*/}

        {/*开始：突击队经费*/}
        {/*<Card title="突击队学科建设经费数">*/}
        {/*  <Row gutter={[24, 24]}>*/}
        {/*    <Col span={24}>*/}
        {/*      <Table pagination={{pageSize: 20}} columns={columns} dataSource={findData}/>*/}
        {/*    </Col>*/}
        {/*  </Row>*/}
        {/*</Card>*/}
        {/*结束：突击队经费*/}

        {/*开始：四大指标*/}
        <Card title="国家级学术领军人才（含青年人才）情况">
          <Row>
            <Col span={10}>
              <Table_01/>
            </Col>
            <Col span={8}>
              <Emm01_1/>
            </Col>
          </Row>




          {/*<Row>*/}
          {/*  <Col><Emm01_1/></Col>*/}
          {/*  <Col><Emm01_2/></Col>*/}
          {/*  <Col><Emm01_3/></Col>*/}
          {/*</Row>*/}
        </Card>


        <Card title="主持国家重点重大项目情况">

          <Row>
            <Col span={10}>
              <Table_02/>
            </Col>
            <Col span={8}>
              <Emm01_2/>
            </Col>
          </Row>




          {/*<Row>*/}
          {/*  <Col>*/}
          {/*    <Emm02_1/>*/}
          {/*  </Col>*/}
          {/*  <Col>*/}
          {/*    <Emm02_2/>*/}
          {/*  </Col>*/}
          {/*  <Col>*/}
          {/*    <Emm02_3/>*/}
          {/*  </Col>*/}
          {/*</Row>*/}
        </Card>


        <Card title="学科国家级奖项情况">
          <Card title={"学科国家级教学成果奖情况"}>
            <Row>
              <Col span={10}>
                <Table_03/>
              </Col>
              <Col span={8}>
                <Emm01_3/>
              </Col>
            </Row>
          </Card>
          <Card title={"教师国家级奖项情况"}>
            <Row>
              <Col span={10}>
                <Table_04/>
              </Col>
              <Col span={8}>
                <Emm01_4/>
              </Col>
            </Row>
          </Card>


          {/*<Row>*/}
          {/*  <Col>*/}
          {/*    <Emm03_1/>*/}
          {/*  </Col>*/}
          {/*  <Col>*/}
          {/*    <Emm03_2/>*/}
          {/*  </Col>*/}
          {/*</Row>*/}
        </Card>

        <Card title="国家级平台建设情况">

          <Row>
            <Col span={10}>
              <Table_05/>
            </Col>
            <Col span={8}>
              <Emm01_5/>
            </Col>
          </Row>

          {/*<Row>*/}
          {/*  <Col>*/}
          {/*    <Emm04_1/>*/}
          {/*  </Col>*/}
          {/*  <Col>*/}
          {/*    <Emm04_2/>*/}
          {/*  </Col>*/}
          {/*</Row>*/}
        </Card>

        {/*结束：四大指标*/}

        {/*start Syl progress bar*/}
        {/*<Row gutter={[24, 24]}>*/}
        {/*  <Col className={"good-col-15-2000"} xxl={{span: 15}} xl={{span: 24}}>*/}
        {/*    <ProgressCharts/>*/}
        {/*  </Col>*/}
        {/*  <Col className={"good-col-9-2000"} xxl={{span: 9}} xl={{span: 24}}>*/}
        {/*    <Card title="学科评估情况" bordered={false} className={'box-r'} style={{height: '485px'}}>*/}
        {/*      <ProgressTable/>*/}
        {/*    </Card>*/}
        {/*  </Col>*/}
        {/*</Row>*/}
        {/*end Syl progress bar*/}

        {/*<Row gutter={[24, 24]}>*/}
        {/*  <Col className={"good-col-15-2000"} xxl={{span: 15}} xl={{span: 24}}>*/}
        {/*    <Card title="大人才"></Card>*/}
        {/*  </Col>*/}
        {/*  <Col className={"good-col-9-2000"} xxl={{span: 9}} xl={{span: 24}}>*/}
        {/*    <Card title="大人才"></Card>*/}
        {/*  </Col>*/}
        {/*</Row>*/}

        {/*<Row gutter={[24, 24]}>*/}
        {/*  <Col className={"good-col-15-2000"} xxl={{span: 15}} xl={{span: 24}}>*/}
        {/*    <Card title="大项目"></Card>*/}
        {/*  </Col>*/}
        {/*  <Col className={"good-col-9-2000"} xxl={{span: 9}} xl={{span: 24}}>*/}
        {/*    <Card title="大项目"></Card>*/}
        {/*  </Col>*/}
        {/*</Row>*/}

        {/*<Row gutter={[24, 24]}>*/}
        {/*  <Col className={"good-col-15-2000"} xxl={{span: 15}} xl={{span: 24}}>*/}
        {/*    <Card title="大平台"></Card>*/}
        {/*  </Col>*/}
        {/*  <Col className={"good-col-9-2000"} xxl={{span: 9}} xl={{span: 24}}>*/}
        {/*    <Card title="大平台"></Card>*/}
        {/*  </Col>*/}
        {/*</Row>*/}

        {/*<Row gutter={[24, 24]}>*/}
        {/*  <Col className={"good-col-15-2000"} xxl={{span: 15}} xl={{span: 24}}>*/}
        {/*    <Card title="大奖项"></Card>*/}
        {/*  </Col>*/}
        {/*  <Col className={"good-col-9-2000"} xxl={{span: 9}} xl={{span: 24}}>*/}
        {/*    <Card title="大奖项"></Card>*/}
        {/*  </Col>*/}
        {/*</Row>*/}

        {/*<Row className={'box-Row'} style={{height:'520px'}}>*/}
        {/*  <Col className={'b-style box-r'}>*/}
        {/*    <RadarCharts/>*/}
        {/*  </Col>*/}
        {/*  <Col span={6}>*/}
        {/*    <Card title="优秀学科统计" bordered={false} className={'box-r l-style'} style={{height:'520px',marginBottom:'30px'}}>*/}
        {/*      <Demo/>*/}
        {/*    </Card>*/}
        {/*  </Col>*/}
        {/*</Row>*/}

        {/*<Row className={'box-Row'}>*/}
        {/*<Card title="全省一流学科经费统计" bordered={false} className={'box-r b-style'}>*/}
        {/*  /!*<Demo3/>*!/*/}
        {/*  <Demo16/>*/}
        {/*</Card>*/}
        {/*/!*<h1>2模块</h1>*!/*/}
        {/*/!*<Card title="教学成果奖和一流课程" bordered={false}>*!/*/}
        {/*/!*  <Demo10/>*!/*/}
        {/*/!*</Card>*!/*/}
        {/*<Col span={6}>*/}
        {/*  <Card title="教学成果统计" bordered={false} className={'box-r l-style'}>*/}
        {/*    <Demo2/>*/}
        {/*  </Card>*/}
        {/*</Col>*/}
        {/*</Row>*/}

        {/*<Row className={'box-Row'}>*/}
        {/*  <Card title="江西省人才培养平台、基地" bordered={false} className={'box-r b-style'}>*/}
        {/*    <Demo14/>*/}
        {/*  </Card>*/}
        {/*  <Col span={6}>*/}
        {/*    <Card title="近三年一流课程获奖数" bordered={false} className={'box-r l-style'}>*/}
        {/*      <Demo4/>*/}
        {/*    </Card>*/}
        {/*  </Col>*/}
        {/*</Row>*/}


        {/*<Row>*/}
        {/*  <Col span={12}>*/}
        {/*    <Card>*/}
        {/*      <Demo20/>*/}
        {/*    </Card>*/}
        {/*  </Col>*/}
        {/*  <Col span={12}>*/}
        {/*    <Card>*/}
        {/*      <Demo21/>*/}
        {/*    </Card>*/}
        {/*  </Col>*/}
        {/*</Row>*/}

        {/*<h1>3模块</h1>*/}
        {/*<Row>*/}
        {/*  <Col span={8}>*/}
        {/*    <Card title="计算机教师结构" bordered={false}>*/}
        {/*      <Demo5/>*/}
        {/*    </Card>*/}
        {/*  </Col>*/}
        {/*  <Col span={8}>*/}
        {/*    <Card title="数学教师结构" bordered={false}>*/}
        {/*      <Demo5/>*/}
        {/*    </Card>*/}
        {/*  </Col>*/}
        {/*  <Col span={8}>*/}
        {/*    <Card title="哲学教师结构" bordered={false}>*/}
        {/*      <Demo5/>*/}
        {/*    </Card>*/}
        {/*  </Col>*/}
        {/*</Row>*/}


        {/*<Row className={'box-Row'}>*/}
        {/*  <Card title="国际化水平比较" bordered={false} className={'box-r b-style'}>*/}
        {/*    <Demo11/>*/}
        {/*  </Card>*/}
        {/*  <Card title="双一流学科博士后及科研助理" bordered={false} className={'box-r l-style'}>*/}
        {/*    <Demo19/>*/}
        {/*  </Card>*/}
        {/*</Row>*/}

        {/*<h1>4模块</h1>*/}
        {/*<Row>*/}
        {/*  <Col span={24}>*/}
        {/*    <Card title="国际合作论文数" bordered={false}>*/}
        {/*      <Demo7/>*/}
        {/*    </Card>*/}
        {/*  </Col>*/}
        {/*</Row>*/}
        {/*<Row className={'box-Row'}>*/}
        {/*  <Card title="国内外期刊发表论文数" bordered={false} className={'box-r b-style'}>*/}
        {/*    <Demo15/>*/}
        {/*  </Card>*/}
        {/*  <Col span={6}>*/}
        {/*    <Card title="各院校省级以上师德标兵获奖人数" bordered={false} className={'box-r l-style'}>*/}
        {/*      <Demo17/>*/}
        {/*    </Card>*/}
        {/*  </Col>*/}
        {/*</Row>*/}

        {/*<Row className={'box-Row'}>*/}
        {/*  <Card title="各学校分别获得国家级、省部级奖项数" bordered={false} className={'box-r b-style'}>*/}
        {/*    <Demo12/>*/}
        {/*  </Card>*/}
        {/*  <Col span={6}>*/}
        {/*    <Card title="参与国内外标准制定数目" bordered={false} className={'box-r l-style'}>*/}
        {/*      <Demo18/>*/}
        {/*    </Card>*/}
        {/*  </Col>*/}
        {/*</Row>*/}

        {/*<Row className={'box-r box-Row'}>*/}
        {/*  <Col span={24}>*/}
        {/*    <RadarCharts2/>*/}
        {/*  </Col>*/}
        {/*</Row>*/}

        {/*<Row className={'box-r box-Row'}>*/}
        {/*  <Card title="纵横向到校科研经费数" bordered={false} className={'box-r b-style'}>*/}
        {/*    <Demo16/>*/}
        {/*  </Card>*/}
        {/*  <Card title="学校国家级平台建设情况" bordered={false} className={'box-r l-style'}>*/}
        {/*    <Demo13/>*/}
        {/*  </Card>*/}
        {/*</Row>*/}

        {/*<h1>5模块</h1>*/}
        {/*<Card title="成果转化到金额" bordered={false}>*/}
        {/*  <Demo8/>*/}
        {/*</Card>*/}

        {/*<CardCharts/>*/}
        {/*<BarCharts/>*/}
      </Space>
    </PageContainer>
  )
}

